        @if(isset($model))
	{!! Form::model($model, ['method' => 'PUT', 'files' => true, 'route' => ['admin.goods.update', $model->id]]) !!}
	@else
	{!! Form::open(['files' => true, 'route' => 'admin.goods.store']) !!}
	@endif
	<div class="form-group">
		{!! Form::label('name', '产品名称:') !!}
		{!! Form::text('name', null, ['class' => 'form-control']) !!}
		{!! $errors->first('name', '<div class="text-danger">:message</div>') !!}
	</div>
        <div class="form-group">
		{!! Form::label('codeno', '产品型号:') !!}
		{!! Form::text('codeno', isset($model)?null:'P'.date('YmdHis'), ['class' => 'form-control']) !!}
		{!! $errors->first('codeno', '<div class="text-danger">:message</div>') !!}
	</div>
	<div class="form-group">
		{!! Form::label('price', '单价:') !!}
		{!! Form::text('price', null, ['class' => 'form-control']) !!}
		{!! $errors->first('price', '<div class="text-danger">:message</div>') !!}
	</div>
        <div class="form-group">
		{!! Form::label('cost_price', '成本价:') !!}
		{!! Form::text('cost_price', null, ['class' => 'form-control']) !!}
		{!! $errors->first('cost_price', '<div class="text-danger">:message</div>') !!}
	</div>
        <div class="form-group">
		{!! Form::label('danwei', '单位名称:') !!}
		{!! Form::text('danwei', null, ['class' => 'form-control']) !!}
		{!! $errors->first('danwei', '<div class="text-danger">:message</div>') !!}
	</div>

	<div class="form-group">
		{!! Form::label('content', '介绍:') !!}
		{!! Form::textarea('content', null, ['class' => 'form-control', 'id' => 'ckeditor']) !!}
		{!! $errors->first('content', '<div class="text-danger">:message</div>') !!}
	</div>
	<div class="form-group">
		{!! Form::label('image', '图片:') !!}
		{!! Form::file('image', ['class' => 'form-control']) !!}
		{!! $errors->first('image', '<div class="text-danger">:message</div>') !!}
	</div>
	@if(isset($model))
	<div class="form-group">
		@if($model->image)
		<img class="img-responsive" src="{!! asset('goods/' . $model->image) !!}">
		@endif
	</div>
	@endif
	<div class="form-group">
		{!! Form::submit(isset($model) ? '更新' : '保存', ['class' => 'btn btn-primary']) !!}
	</div>
{!! Form::close() !!}

@section('script')
	
	{!! script('vendor/ckeditor/ckeditor.js') !!}
	{!! script('vendor/ckfinder/ckfinder.js') !!}
	
	<script type="text/javascript">
		var prefix = '{!! asset(option("ckfinder.prefix")) !!}';
		CKEDITOR.editorConfig = function( config ) {
		   config.filebrowserBrowseUrl = prefix + '/vendor/ckfinder/ckfinder.html';
		   config.filebrowserImageBrowseUrl = prefix + '/vendor/ckfinder/ckfinder.html?type=Images';
		   config.filebrowserFlashBrowseUrl = prefix + '/vendor/ckfinder/ckfinder.html?type=Flash';
		   config.filebrowserUploadUrl = prefix + '/vendor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files';
		   config.filebrowserImageUploadUrl = prefix + '/vendor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images';
		   config.filebrowserFlashUploadUrl = prefix + '/vendor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash';
		};

		var editor = CKEDITOR.replace( 'ckeditor' );
		CKFinder.setupCKEditor( editor, prefix + '/vendor/ckfinder/') ;
	</script>
@stop
